<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Index de prueba para authenticar con outh2 con google</title>
<script type="text/javascript">


console.log("Cargando config dojoConfig 1");

	var dojoConfig = {
		dojoBlankHtmlUrl: location.pathname.replace(/\/[^/]+$/, '') + '/blank.html',
		packages: [{
			name: 'custom',
			location: location.pathname.replace(/\/[^/]+$/, '') + '/js/dojo/demo'
		},{
			name: 'auth',
			location: location.pathname.replace(/\/[^/]+$/, '') + '/js/outh2'
		}
		]
	};
	
	</script>
	<!-- load dojo and provide config via data attribute -->
	<script src="//ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/dojo.js"></script>
<script type="text/javascript">
	function pruebaAuthenticateGoogle(){
		require(["auth/authenticateGoogle"], function (authenticateGoogle) {
			authenticateGoogle.init();
	     });
	  
	}
	
	function autorizaAhora(){
		require(["auth/authenticateGoogle"], function (authenticateGoogle) {
			authenticateGoogle.auth(false); return false;
		 });
	}
	
	function insertarDato(){
		require(["auth/authenticateGoogle"], function (authenticateGoogle) {
			//authenticateGoogle.auth(false); return false;
			authenticateGoogle.insertData(); return false;
			
		 });
	}
</script>

 <script src="https://apis.google.com/js/client.js?onload=pruebaAuthenticateGoogle"></script>
</head>
<body>
 <body>
    <h1>
      Fusion Tables JavaScript Example
    </h1>
    <h2>
      (1) Authorize using OAuth 2.0
    </h2>
    <p>
      Click Authorize to start the OAuth 2.0 authorization flow. If you have
      already authorized, the button will be disabled.
    </p>
    <input type="button" id="authorize-button" value="Authorize" onclick="autorizaAhora()"><br>
    
    <input type="button" id="insert-button" value="Insertar" onclick="insertarDato()">
</body>
</html>